package com.example.myactspringboot.listener;

import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.ExecutionListener;
import org.activiti.engine.delegate.TaskListener;

/**
 * @Create 2023-10-22 17:50
 * @Description
 */
public class MultiExecuListener implements TaskListener {
//串行并行都看最后一个执行的是同意还是不同意
/*    @Override
    public void notify(DelegateTask execution) {
        System.out.println("任务会签总数："+execution.getVariable("nrOfInstances"));
        System.out.println("待会签任务数量："+execution.getVariable("nrOfActiveInstances"));
        System.out.println("已完成会签任务数量："+execution.getVariable("nrOfCompletedInstances"));
        boolean power = (boolean) execution.getVariable("power");
        if (!power){
            execution.setVariable("status","false");
            return;
        }
//设置权重
        //总人数
        Integer nrOfInstances = (Integer) execution.getVariable("nrOfInstances");
        double v = nrOfInstances.doubleValue();
        Integer agree = (Integer) execution.getVariable("agree");//同意人数
        double v1 = agree.doubleValue();
        if(v1/v>0.5){
            System.out.println("同意人数："+agree);
            //设置会签结果 排他网关会用到
            execution.setVariable("status","true");
        }else{
            execution.setVariable("status","false");

        }
    }*/
@Override
public void notify(DelegateTask execution) {

}
}
